package com.bw.aop;

import com.alibaba.fastjson.JSON;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyBeforeAop {

    @Before("execution(* com.bw.service.*.*(..))")
    public void before(JoinPoint joinPoint){

        //，打印方法名称和参数
        String name = joinPoint.getSignature().getName();
        Object[] args = joinPoint.getArgs();
        System.out.println("方法名" + name);
        System.out.println("方法入参" + JSON.toJSONString(args));
    }
}
